<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let str = '123';
        console.log(Number(str));   // 123
        console.log(parseInt('12.89px')); // 12
        console.log(parseInt('a12.89px'));  // NaN
        console.log(parseFloat('12.89px')); // 12.89
        console.log(parseFloat('a12.89px')); // NaN
    </script>
</body>
</html>